			var ContentHeight = 350;
			var TimeToSlide = 200.0;

			var openAccordion = '';

			function PostComment(profileId,productType)
			{
				var http = new XMLHttpRequest();
				var url = "myinventory/InventoryInsert.php";
				
				var postText=document.getElementById('textArea-type'+productType).value;
				//if there is something to post
				if (postText == null || postText == "")
					return;
				
				var params = "iProfile=" + profileId + "&iProductType=" + productType +"&sText="+postText;
				http.open("POST", url, true);

				//Send the proper header information along with the request
				http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				http.setRequestHeader("Content-length", params.length);
				http.setRequestHeader("Connection", "close");

				http.onreadystatechange = function() 
				{//Call a function when the state changes.
					if(http.readyState == 4 && http.status == 200) 
					{
						var accordionContent=document.getElementById("Accordion"+productType+"Content");
						accordionContent.innerHTML=http.responseText;
					}
				}
				http.send(params);
			}
			function EditPost(profileId,productType,inventoryNbr)
			{
				//required action
				var action=document.getElementsByName("input-"+ inventoryNbr)[0].value;	
				//if edit
				if (action=="edit")
				{
					//change image
					document.getElementById("img-"+ inventoryNbr).src = "myinventory/PostSaveChanges.png";
					//enable field
					document.getElementById("txtArea-"+ inventoryNbr).disabled = false;
					//set value in  hidden input
					document.getElementsByName("input-"+ inventoryNbr)[0].value = "save";
				}
				//action == save
				else if (action=="save")
				{
					var http = new XMLHttpRequest();
					var url = "myinventory/InventoryUpdate.php";
					
					var postText=document.getElementById('txtArea-'+inventoryNbr).value;
					//if there is something to post
					if (postText == null || postText == "")
						return;
					
					var params = "iProfile=" + profileId + "&iProductType=" + productType +"&sText="+postText+"&iInventory="+inventoryNbr;
					http.open("POST", url, true);

					//Send the proper header information along with the request
					http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					http.setRequestHeader("Content-length", params.length);
					http.setRequestHeader("Connection", "close");

					http.onreadystatechange = function() 
					{//Call a function when the state changes.
						if(http.readyState == 4 && http.status == 200) 
						{
							var accordionContent=document.getElementById("Accordion"+productType+"Content");
							accordionContent.innerHTML=http.responseText;
						}
					}
					http.send(params);
				}//end else action == save
			}//end EditPost 
			function runAccordion(index)
			{
			  var nID = "Accordion" + index + "Content";
			  if(openAccordion == nID)
				nID = '';
				
			  setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'" + openAccordion + "','" + nID + "')", 33);
			  
			  openAccordion = nID;
			}
			function runNewComment(index)
			{
			  var nID = "Accordion" + index + "Content";
			  if(openAccordion == nID)
				nID = '';
				
			  setTimeout("animate(" + new Date().getTime() + "," + TimeToSlide + ",'" + openAccordion + "','" + nID + "')", 33);
			  
			  openAccordion = nID;
			}

			function animate(lastTick, timeLeft, closingId, openingId)
			{  
			  var curTick = new Date().getTime();
			  var elapsedTicks = curTick - lastTick;
			  
			  var opening = (openingId == '') ? null : document.getElementById(openingId);
			  var closing = (closingId == '') ? null : document.getElementById(closingId);
			 
			  if(timeLeft <= elapsedTicks)
			  {
				if(opening != null)
				  opening.style.height = ContentHeight + 'px';
				
				if(closing != null)
				{
				  closing.style.display = 'none';
				  closing.style.height = '0px';
				}
				return;
			  }
			 
			  timeLeft -= elapsedTicks;
			  var newClosedHeight = Math.round((timeLeft/TimeToSlide) * ContentHeight);

			  if(opening != null)
			  {
				if(opening.style.display != 'block')
				  opening.style.display = 'block';
				opening.style.height = (ContentHeight - newClosedHeight) + 'px';
			  }
			  
			  if(closing != null)
				closing.style.height = newClosedHeight + 'px';

			  setTimeout("animate(" + curTick + "," + timeLeft +",'" + closingId + "','" + openingId + "')", 33);
			}